package com.nageffer.shortlink.project.mq.producer;

import lombok.RequiredArgsConstructor;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.stereotype.Component;

import java.util.Map;

@Component
@RequiredArgsConstructor
public class RabbitMqStatsProducer {

    private final RabbitTemplate rabbitTemplate;

    /**
     * 发送延迟消费短链接统计
     */
    public void send(Map<String, String> producerMap) {
        //交换机名称
        String exchangeName = "shortLink.exchange";
        //路由key
        String key = "shortLink";
        // 发送消息
        rabbitTemplate.convertAndSend(exchangeName, key, producerMap);
    }

}
